﻿@model SDSystem.Models.Restaurant
@{
    ViewBag.Title = "Edit Restaurant";
    Layout = "~/Views/Shared/_LayoutHtml.cshtml";
}

@using(Html.BeginForm())
{
    @Html.ValidationSummary(true)
    <fieldset>
        
        @Html.HiddenFor(model=>model.RestaurantId)
        <div class="editor-label">
            @Html.LabelFor(model => model.Name)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Name)
            @Html.ValidationMessageFor(model => model.Name)
        </div>
        
        <div class="editor-label">
            @Html.LabelFor(model => model.Image)
        </div>
        <div class="editor-field">
            @Html.TextBoxFor(model => model.Image,new {@id="ResImage"})
            @Html.ValidationMessageFor(model => model.Name)
            <input type="button" value="Browser..." id="btnImage"/>
            <script type="text/javascript">
                $(document).ready(function () {
                    $("#btnImage").click(function () {
                        var ckImage = new CKFinder();
                        ckImage.selectActionFunction = function (fileUrl) {
                            $("#ResImage").val(fileUrl);
                        };
                        ckImage.popup();
                    });
                });
            </script>
        </div>
        
        <div class="editor-label">
            @Html.LabelFor(model => model.Description)
        </div>
        <div class="editor-field">
            @Html.TextAreaFor(m => m.Description, new { @id = "descriptionCk" })
            <script type="text/javascript">
                var editorContent = CKEDITOR.replace("descriptionCk");
                CKFinder.setupCKEditor(editorContent, '/ckfinder/');
            </script>
        </div>
        
        <div class="editor-label">
            @Html.LabelFor(model => model.RContent)
        </div>
        <div class="editor-field">
            @Html.TextAreaFor(m => m.RContent, new { @id = "contentCk" })
            <script type="text/javascript">
                var editorContent = CKEDITOR.replace("contentCk");
                CKFinder.setupCKEditor(editorContent, '/ckfinder/');
            </script>
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Street)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Street)
            @Html.ValidationMessageFor(model => model.Street)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.City)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.City)
            @Html.ValidationMessageFor(model => model.City)
        </div>
        <br/>
        <p>
            <input type="submit" value="Create"/>
        </p>
    </fieldset>
}
